#!/bin/bash
echo "=======compile musl with rv64gc======="
rm -rf build install_rv64gc install_rv64gcv
mkdir build
cd build
export CROSS_COMPILE=riscv64-unknown-linux-musl-
export CC=${CROSS_COMPILE}gcc
export AR=${CROSS_COMPILE}ar
export LD=${CROSS_COMPILE}ld
export AS=${CROSS_COMPILE}as
export RANLIB=${CROSS_COMPILE}ranlib

export CFLAGS="-march=rv64gc -mabi=lp64d"
routes=$PWD
../musl-1.2.4/configure --prefix=$routes/../install_rv64gc --host=riscv64-unknown-linux-musl
make -j 
make install
echo "=======compile musl rv64gc end======="

echo "=======compile musl with rv64gcv======="
rm -rf ./*
export CFLAGS="-march=rv64gcv -mabi=lp64d"
../musl-1.2.4/configure --prefix=$routes/../install_rv64gcv --host=riscv64-unknown-linux-musl
make -j 
make install
echo "=======compile musl rv64gcv end======="
